This page last changed on Dec 22, 2008 by sfentress.

For the Spring 2009 Newsletter we wanted to be able to demo OTrunk-based activities from a CD.

CD example

The attached zip file is a simple example of the contents of the CD (excluding non-otrunk content, such as MW). This example does not include the Java Cache (all the jars), as these can be generated after downloading.

To run the example, first unzip the directory on to the hard drive. To generate the java_cache, we must run the jnlp2script jar pointing to both the jnlp we want to use and the java_cache we will use. In the terminal, navigate to the /resources folder that was unzipped and run

java -jar jnlp2shell.jar file://path/to/resources/otrunk-launcher.jnlp java_cache

e.g. If sfentress unzipped the file to the folder newsletter_cd, he would run

After this has completed, the java_cache folder should be filled with jars, and be about 70 MB in size.

The CD can be tested by double-clicking on the start.jar file. A web page should load, from which the user may navigate to examples. Clicking any example will launch the example in a new JVM.

The contents of the unzipped folder, including the filled java_cache directory, can then be burned to a CD.

Technical details

The start.jar is launching the HtmlLauncher class in the jnlp-installer project. This class can load and display html files. If no file is passed in, it will look for one in resources/index.html.

The example links contain runtime commands to be executed. In this case, the links launch the jnlp2shell jar, which will itself launch a jnlp. An example link is as follows

<a href="exec:java -Djnlp2shell.read_only=true -Djnlp2shell.run=true -jar ${jar-home}/resources/jnlp2shell.jar file://${jar-home}/resources/otrunk-launcher.jnlp 
${jar-home}/resources/java_cache http://continuum.concord.org/otrunk/examples/UDL/udl-friction-34.otml">UDL Friction</a>

Here we see that the link starts with "exec:", which will cause the subsequent command to be executed by the environment.

Two System variables are set, -Djnlp2shell.read_only=true -Djnlp2shell.run=true, which will cause the jnlp2shell to (1) not attempt to write to the file, and (2) launch the jnlp.

The name of the jar, jnlp and java cache are all prepended with the string

${jar-home}
The HtmlLauncher will replace this string with the absolute path to the start jar.

Finally, the location of the otml file is given at the end. The Jnlp2Shell program will pass on any arguments that are added after the cache location to the java program it launches. In this case, the OTViewer will use this argument to load the appropriate otml file. Both online and local otml files may be used: to use a local otml file, this argument should be of the form

file://${jar-home}/path/to/otml/file.otml
This part of the link is the only part that needs to be changed for different examples to be run.


newsletter_cd.zip (application/x-zip)
Document generated by Confluence on Jan 27, 2014 16:52